#include "unp.h"

void client(int in,int out)
{

  size_t len;
  ssize_t n;
  char buf[MAXLINE];
  if(fgets(buf,MAXLINE,stdin) == NULL)
  {
     err_sys("fgets error");
  }
  
  len = strlen(buf);
  if(buf[len-1] == '\n'){
     len--;
  }
 
  n = write(out,buf,len);
  if(n != len){
    err_sys("write error");
  }
 
  while((n=read(in,buf,MAXLINE)) > 0){
     printf("client has read:%d\n",n);
     write(STDOUT_FILENO,buf,n);
  } 
}

